package top.zhangjianyong.tools.user;

import top.zhangjianyong.tools.entity.User;

import java.util.Arrays;
import java.util.List;

/**
 * @author zhangjianyong
 * @since 2025/3/24 下午3:31
 */
public class SystemUserChecker implements UserChecker {

    private final static List<String> IGNORE_URI =
            Arrays.asList("/static/", "/test/",
                    "/user/login", "/user/reg", "/remindItem/close/", "/remindItem/get/", "/remindItem/reset",
                    "/privateInfo", "/canteen", "/etf/update/all", "/etf", "/mairui", "/bill/reload",
                    "/poet", "/free", "/torrent", "/holiday", "/remindItem/closeNoCheck",
                    "/area", "/mairui", "/wechat");

    @Override
    public boolean doCheck(String uri) {
        if (IGNORE_URI.stream().anyMatch(uri::startsWith)) return true;
        IUser user = UserHolder.user(User.class);
        return user != null;

    }
}
